﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin-One-Column.master" AutoEventWireup="true" CodeBehind="QuanLiNXB.aspx.cs" Inherits="BookStore.admin.QuanLiNXB" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BreadcrumbsContent" runat="server">
<h1>Quản Lí Nhà Xuất Bản</h1>
<br />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainColumnContent" runat="server">
    <div id="admin-table">
        <asp:GridView ID="NXB_GV" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            DataSourceID="NXB_GVDS" DataKeyNames="MaNXB" CellPadding="4" 
            ForeColor="#333333" GridLines="None" PageSize="5">
            <AlternatingRowStyle CssClass="alt-row" BackColor="White" />
            <Columns>
                <asp:TemplateField HeaderText="Mã" InsertVisible="False" 
                    SortExpression="MaNXB">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("MaNXB") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("MaNXB") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="20px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên Nhà Xuất Bản" SortExpression="TenNXB">
                    <EditItemTemplate>
                        <asp:TextBox CssClass="input-text" ID="TextBox1" runat="server" Text='<%# Bind("TenNXB") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" Text='<%# Eval("TenNXB") %>' runat="server" ></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="200px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Địa Chỉ" SortExpression="DiaChi">
                    <EditItemTemplate>
                        <asp:TextBox CssClass="input-text" ID="TextBox2" runat="server" Text='<%# Bind("DiaChi") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("DiaChi") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số ĐT" SortExpression="SoDT">
                    <EditItemTemplate>
                        <asp:TextBox CssClass="input-text" ID="TextBox3" runat="server" Text='<%# Bind("SoDT") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("SoDT") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="100px" />
                </asp:TemplateField>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                            CommandName="Update" Text=""><img alt="Delete" src="../images/check.png"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Cancel" Text="Cancel"><img alt="Delete" src="../images/cross.png"></asp:LinkButton>
                            
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                            CommandName="Edit" Text=""><img alt="Edit" src="../images/pencil.png"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                            CommandName="Delete" Text=""><img alt="Delete" src="../images/cross.png"></asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle Width="50px" />
                </asp:TemplateField>
            </Columns>
            <EditRowStyle CssClass="align-top" BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" BackColor="#666666" ForeColor="White" 
                HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>
        <asp:SqlDataSource ID="NXB_GVDS" runat="server" ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>"
            
            SelectCommand="SELECT [MaNXB], [TenNXB], [DiaChi], [SoDT] FROM [NhaXuatBan]" 
            ConflictDetection="CompareAllValues" 
            DeleteCommand="DELETE FROM [NhaXuatBan] WHERE [MaNXB] = @original_MaNXB AND (([TenNXB] = @original_TenNXB) OR ([TenNXB] IS NULL AND @original_TenNXB IS NULL)) AND (([DiaChi] = @original_DiaChi) OR ([DiaChi] IS NULL AND @original_DiaChi IS NULL)) AND (([SoDT] = @original_SoDT) OR ([SoDT] IS NULL AND @original_SoDT IS NULL))" 
            InsertCommand="INSERT INTO [NhaXuatBan] ([TenNXB], [DiaChi], [SoDT]) VALUES (@TenNXB, @DiaChi, @SoDT)" 
            OldValuesParameterFormatString="original_{0}" 
            UpdateCommand="UPDATE [NhaXuatBan] SET [TenNXB] = @TenNXB, [DiaChi] = @DiaChi, [SoDT] = @SoDT WHERE [MaNXB] = @original_MaNXB AND (([TenNXB] = @original_TenNXB) OR ([TenNXB] IS NULL AND @original_TenNXB IS NULL)) AND (([DiaChi] = @original_DiaChi) OR ([DiaChi] IS NULL AND @original_DiaChi IS NULL)) AND (([SoDT] = @original_SoDT) OR ([SoDT] IS NULL AND @original_SoDT IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_MaNXB" Type="Int32" />
                <asp:Parameter Name="original_TenNXB" Type="String" />
                <asp:Parameter Name="original_DiaChi" Type="String" />
                <asp:Parameter Name="original_SoDT" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="TenNXB" Type="String" />
                <asp:Parameter Name="DiaChi" Type="String" />
                <asp:Parameter Name="SoDT" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="TenNXB" Type="String" />
                <asp:Parameter Name="DiaChi" Type="String" />
                <asp:Parameter Name="SoDT" Type="String" />
                <asp:Parameter Name="original_MaNXB" Type="Int32" />
                <asp:Parameter Name="original_TenNXB" Type="String" />
                <asp:Parameter Name="original_DiaChi" Type="String" />
                <asp:Parameter Name="original_SoDT" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>
